package com.qys.livesMall.product.controller.sys;

import com.qys.livesMall.common.result.R;
import com.qys.livesMall.product.entity.ProductSkuAttributeOptions;
import com.qys.livesMall.product.model.ProductSkuAttributeOptionsDTO;
import com.qys.livesMall.product.service.ProductSkuAttributeOptionsService;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  产品规格备注
 * </p>
 *
 * @author gmx
 * @since 2023-06-13
 */
@RestController
@RequestMapping("/sys/productSkuAttributeOptions")
public class ProductSkuAttributeOptionsController {

    @Resource
    private ProductSkuAttributeOptionsService productSkuAttributeOptionsService;
    /***
     * 修改规格
     */
    @PostMapping(value ="/edit")
    public R edit(@RequestBody ProductSkuAttributeOptionsDTO dto){
        ProductSkuAttributeOptions productSkuAttributeOptions=new ProductSkuAttributeOptions();
        BeanUtils.copyProperties(dto,productSkuAttributeOptions);
        boolean b = productSkuAttributeOptionsService.updateById(productSkuAttributeOptions);
        if(!b){
            return R.fail("修改sku规格失败");
        }
        return R.ok();
    }
}
